<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>1-9 bfc</title>
  <style>
    .container {
      width: 300px;
      border: solid 5px orange;
    }

    .box {
      width: 100px;
      height: 100px;
      float: left;
      border: solid 5px #a00;
      box-sizing: border-box;
    }

    /* 推荐使用 */
    .clearfix::after {
      content: "";
      display: block;
      clear: both;
    }
  </style>
</head>

<body>
  <div class="container clearfix">
    <div class="box"></div>
    <div class="box"></div>
  </div>
  <ul>
    <li>lorem1</li>
    <li>lorem2</li>
    <li>lorem3</li>
    <li>lorem4</li>
  </ul>
</body>

</html>